package algotithm.acwing.prefixadd.test797;

/**
 * @author zhouyanxiang
 * @Date 2021-01-2021/1/22-10:54
 */
import java.io.*;

public class Main{

    // 数据数组，也是差分数组的 前缀和数组
    // 差分数组b[i]，差分数组的定义：a[i] = b[1] + b[2] + ... + b[i]
    // 同时求差分数组的一种方式是：b[i] = a[i] - b[i - 1]
    // 比如：b[1] = a[1] - 0, b[2] = a[2] - a[1] 又因为 a[2] = b[1] + b[2]，
    // 所以和上面两者是相等的
    // b[i] = a[i] - b[i-1]
    // b[i] = a[i] - a[i-1]
    // 因此最后输出可以输出b[i]，那就可以用b[i] += b[i-1]实际上就是求a[i]
    // 或者a[i] = a[i-1] + b[i]

    private static int N = 100010;
    private static int[] a = new int[N];
    private static int[] b = new int[N];

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));


        String[] num = reader.readLine().split(" ");
        int n = Integer.parseInt(num[0]);
        int m = Integer.parseInt(num[1]);
        String[] num2 = reader.readLine().split(" ");
        for (int i = 1; i <= n; i++) {
            a[i] = Integer.parseInt(num2[i-1]);
        }
        for (int i = 1; i <= n; i++) {
            insert(i,i,a[i]);
        }
        while (m-- > 0) {
            String[] num3 = reader.readLine().split(" ");
            int l = Integer.parseInt(num3[0]);
            int r = Integer.parseInt(num3[1]);
            int c = Integer.parseInt(num3[2]);
            insert(l,r,c);
        }
         for (int i = 1; i <= n; i++) {
             b[i] += b[i-1];
         }
         for (int i = 1;i <= n; i++) {
             writer.write(b[i] + " ");
         }
//        for (int i = 1; i <= n; i++) {
//            a[i] = a[i-1] + b[i];
//        }
//        for (int i = 1;i <= n; i++) {
//            writer.write(a[i] + " ");
//        }


        writer.write("\n");
        writer.flush();
        writer.close();
        reader.close();
    }

    public static void insert(int l,int r,int c) {
        b[l] += c;
        b[r+1] -= c;
    }

}